<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta content="email=no" name="format-detection">
    <meta content="telephone=no" name="format-detection">
    <meta name="msapplication-tap-highlight" content="no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
    <link rel="shortcut icon" href="http://www.tyfo.com/market/content/home_image/favicon.ico" type="image/x-icon" />
    <title>转盘抽奖</title>
    <script src="http://www.tyfo.com/common/js/jquery-1.11.1.min.js"></script>
    <style>
        body,p{margin: 0;}
        .rui-luck-draw{
            width: 100vw;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
        }
        .rui-luck-box {
            width: 75vw;
            height: 73vw;
            max-width: 600px;
            max-height: 600px;
            position: absolute;
            top: 11.5vw;
            left: 12vw;
        }

        .rui-luck-box div {
            width: 32%;
            height: 30%;
            text-align: center;
            box-sizing: border-box;
            /* border: 3px solid #ddd; */
            border-radius: 10px;
            font-size: 30px;
            position: absolute;
            display: flex;
            display: -webkit-flex;
            justify-content: center;
            align-items: center;
        }
        .rui-luck-box div img{
            width: 100%;
            height: 100%;
        }
        .rui-luck-box div[prize='1'] {
            top: 0;
            left: 0;
            transform: translate(0, 0);
        }

        .rui-luck-box div[prize='2'] {
            top: 0;
            left: 50%;
            transform: translate(-50%, 0);
        }

        .rui-luck-box div[prize='3'] {
            top: 0;
            right: 0;
            transform: translate(0, 0);
        }

        .rui-luck-box div[prize='4'] {
            top: 50%;
            right: 0;
            transform: translate(0, -50%);
        }

        .rui-luck-box div[prize='5'] {
            bottom: 0;
            right: 0;
            transform: translate(0, 0);
        }

        .rui-luck-box div[prize='6'] {
            bottom: 0;
            left: 50%;
            transform: translate(-50%, 0);
        }

        .rui-luck-box div[prize='7'] {
            bottom: 0;
            left: 0;
            transform: translate(0, 0);
        }

        .rui-luck-box div[prize='8'] {
            top: 50%;
            left: 0;
            transform: translate(0, -50%);
        }

        .rui-luck-box div.rui-active {
            box-shadow: 0px 0px 50px inset red;
        }

        .rui-pointer {
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            border: none!important;
        }
        .rui-luck-name{
            font-size: 16px;
            text-align: left;
            height: 30px;
            line-height: 30px;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 100;
        }
        .rui-luck-name a{
            text-decoration: none;
            color: #777;
            padding: 0 20px;
        }
        .rui-luck-content{
            width: 80vw;
            height: 80vw;
            max-width: 600px;
            max-height: 600px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            padding: 10vw;
        }
    </style>
</head>

<body>
    <div class="rui-luck-name">
        <p><a href="./index.html">转盘抽奖之指针旋转抽奖</a></p>
        <p><a href="./prize.html">九宫格抽奖</a></p>
        <p><a href="./turntable.html">转盘抽奖之转盘旋转抽奖</a></p>
    </div>
    <div class="rui-luck-draw">
        <div class="rui-luck-content" style="background:url('./images/chou-bg.png') no-repeat center center/100% 100%;">
            <div class="rui-luck-box">
                <div class="rui-luck-prize" prize="1"><img src="./images/img1.png" alt=""></div>
                <div class="rui-luck-prize" prize="2"><img src="./images/img2.png" alt=""></div>
                <div class="rui-luck-prize" prize="3"><img src="./images/img5.png" alt=""></div>
                <div class="rui-luck-prize" prize="4"><img src="./images/img4.png" alt=""></div>
                <div class="rui-pointer" onclick="startRotate()"></div>
                <div class="rui-luck-prize" prize="5"><img src="./images/img3.png" alt=""></div>
                <div class="rui-luck-prize" prize="6"><img src="./images/img6.png" alt=""></div>
                <div class="rui-luck-prize" prize="7"><img src="./images/img7.png" alt=""></div>
                <div class="rui-luck-prize" prize="8"><img src="./images/img8.png" alt=""></div>
            </div>
        </div>
    </div>
    <script src="./luckDraw.js"></script>
    <script>
        var luckArr = ['10元红包', 'iPad Mini', '莫灰心', '20元话费', '20元话费', '莫灰心', '爱奇艺会员一月', '88元红包'];
        var luck = new LuckDraw();
        var startRotate = function (elem) {
            luck._init({
                rotateId: '.rui-luck-prize',
                activeClass: 'rui-active',
                luckNumber: Math.floor(Math.random() * (7 - 0) + 0),
                typeNumber: 8,
                time: 3000,
                type: 'prize',
                circleNumber: 10,
                success: function (res) {
                    console.log(res.luckNumber)
                    console.log(luckArr[res.luckNumber])
                    alert(luckArr[res.luckNumber])
                }
            });
        }
    </script>
</body>

</html>